home *** CD-ROM | disk | FTP | other *** search
/ Gigarom 1 / Gigarom Macintosh Archives (Quantum Leap)(CDRM1080320)(1993).iso / FILES / DEV / I-Z / ViewIt™ Shareware.sea / ViewIt™ 2.04 Shareware / FaceWare.rsrc / TEXT_1312_BC2. Static Text.txt < prev    next >
Text File  |  1992-08-15  |  5KB  |  36 lines

  1. Static Text
  2.   Static text controls must be of type "Static", and can be optionally linked to STR# or TEXT resources.  If not linked to a resource, then the control's title is displayed as its content, along with whatever frame and background you have chosen.
  3.  
  4. Static Box
  5.   Although static text controls are the simplest types of controls, they still support a full range of text styles, colors, indents, frames, etc.  One important variation is when the static text control is not given a title.  In this case it can be used to display a box (set a non-zero frame size) that encloses other controls.  If the box is transparent (does not have a solid body), then ViewIt allows mouse clicks to pass through the content area of the box, meaning that you don't need to worry about whether the controls bounded by the box are before or after it in the control list.
  6.  
  7. Parameter Strings
  8.   Another important variation of static text items is when they are linked to STR# resources.  In this case BaseCt replaces all "^n" substrings in the control's title with the corresponding strings from the STR# resource. This is similar to, but more powerful than, the Dialog Manager's support for "parameter text".
  9.   For example, if the control's title is "^2 loves ^4", then BaseCt creates a copy of this title and replaces "^2" and "^4" with the second and fourth strings from the linked STR# each time it redraws the control.  A programmer can thus change the appearance of the item at any time by either changing the strings in the STR# or by calling "SetCTitle" to reset the control title to text that references different strings (such as changing "^2 loves ^4" to "^3 dislikes ^5").
  10.   Static text controls linked to STR# resources must have their control Min set equal to 0 (their control Max is not used).  If Min is not equal to 0, then the STR# resource has a different use (see "Icons, Picts, ..." topic).
  11.   Also note that changes made to the STR# list will not be seen until the control is redrawn.  If necessary, use DrwCtl to redraw the control.  For example,
  12.  FaceIt(0,GetCtl,0,0,1,3);
  13.  FaceIt(0,DrwCtl,ord(cControl),0,0,0);
  14. would redraw the third control in the first view of the front window.  It is also necessary to give such controls solid bodies so that old text is completely erased before new text is drawn.
  15.  
  16. TEXT Block
  17.   A third variation of static text occurs when linked to a TEXT resource.  In this case the current content of the TEXT resource is displayed.  If the TEXT resource in memory is changed by the program, then any call that causes the control to be redrawn will update the displayed text.
  18.   The following code, for example, will display the text in a 1000 character C-type string in a static text control (view 2, control 5) that is linked to a TEXT resource ("fRec." dropped for simplicity):
  19.  FaceIt(0L,GetCtl,0L,0L,2L,5L);
  20.  SetHandleSize(cResHdl,1000L);
  21.  BlockMove(&myString[0],*cResHdl,1000L);
  22.  FaceIt(0L,DrwCtl,(long)cControl,2L,0L,0L);
  23. where the TEXT resource must not be purgeable, the "2" in DrwCtl redraws only the content area of the static control, and the control must have a solid body.
  24.  
  25. Options
  26.   The following bit values can be added to VarCode to set various options:
  27.   32:  A static text control normally draws text at the top of the control using the current text justification.  If 32 is added to the VarCode, then the first text line is centered vertically in the control.
  28.   16384:  If a static text control is not linked to a TEXT resource, then it is normally limited to 255 characters (the maximum size of its control title).  If 16384 is added to VarCode, then a separate handle is used to store the control's text and the limit of 255 characters does not apply.  This handle can be found in cHiData after calling GetCtl, and could be used in code like that shown above for moving text into a TEXT handle (replace cResHdl with cHiData).  You can also use data linking to get and set such text.
  29.  
  30. Data Linking
  31.   Static text that is not linked to a TEXT resource has a "value" equal to the control's title, and can be linked to any type of program variable (see "Data Links" in the ViewIt Guide for more info on data linking).  This makes it easy, for example, to have static text items in ViewIt windows directly display integer, real, or string program variables.
  32.   Static text controls linked to TEXT resources base data linking on the linked TEXT resource in memory.  The only advantage to data linking in this case is that it can be used to get ViewIt to do the SetHandleSize, BlockMove, and DrwCtl that would otherwise need to be made to directly update the resource in memory and redraw the control.
  33.   Static text that is not linked to a TEXT resource but has 16384 added to VarCode bases data linking on a private text handle in memory, and can be data linked in the same way as controls linked to TEXT resources.
  34.  
  35. Limitations
  36. No support for colors beyond frame, body, & content.